home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / rcs55.zip / RCS.MS < prev    next >
Text File  |  1991-01-03  |  57KB  |  1,525 lines

  1. .\" Format this file with:
  2. .\" pic file | tbl | troff -ms
  3. .\"
  4. .\" \*s stands for $, and avoids problems when this file is checked in.
  5. .ds s $
  6. .\" PS and PE center pic diagrams. (The corresponding ms-macros may not.)
  7. .de PS
  8. .nr pE (\\n(.lu-\\$2u)/2u
  9. .in +\\n(pEu
  10. .ne \\$1u
  11. ..
  12. .de PE
  13. .in -\\n(pEu
  14. ..
  15. .de D(
  16. .DS
  17. .nr VS 12p
  18. .vs 12p
  19. .I
  20. ..
  21. .de D)
  22. .DE
  23. .nr VS 18p
  24. .vs 18p
  25. .R
  26. ..
  27. .de Id
  28. .ND \\$4
  29. ..
  30. .Id $Id: rcs.ms,v 5.2 1991/01/03 10:57:28 eggert Exp $
  31. .RP
  32. .TL
  33. RCS\*-A System for Version Control
  34. .sp
  35. .AU
  36. Walter F. Tichy
  37. .AI
  38. Department of Computer Sciences
  39. Purdue University
  40. West Lafayette, Indiana 47907
  41. .sp
  42. .AB
  43. An important problem in program development and maintenance is version control,
  44. i.e., the task of keeping a software system consisting of many versions and
  45. configurations well organized.
  46. The Revision Control System (RCS)
  47. is a software tool that assists with that task.
  48. RCS manages revisions of text documents, in particular source programs,
  49. documentation, and test data.
  50. It automates the storing, retrieval, logging and identification of revisions,
  51. and it provides selection mechanisms for composing configurations.
  52. This paper introduces basic version control concepts and
  53. discusses the practice of version control
  54. using RCS.
  55. For conserving space, RCS stores deltas, i.e., differences between
  56. successive revisions.  Several delta storage methods are discussed.
  57. Usage statistics show that RCS's delta storage method is
  58. space and time efficient.
  59. The paper concludes with a detailed survey of version control tools.
  60. .sp
  61. \fBKeywords\fR: configuration management, history management,
  62. version control, revisions, deltas.
  63. .AE
  64. .FS
  65. An earlier version of this paper was published in
  66. .I "Software\*-Practice & Experience"
  67. .B 15 ,
  68. 7 (July 1985), 637-654.
  69. .FE
  70. .nr VS 18p
  71. .LP
  72. .NH
  73. Introduction
  74. .PP
  75. Version control is the task of keeping software
  76. systems consisting of many versions and configurations well organized.
  77. The Revision Control System (RCS) is a set of UNIX
  78. commands that assist with that task.
  79. .PP
  80. RCS' primary function is to manage \fIrevision groups\fR.
  81. A revision group is a set of text documents, called \fIrevisions\fR,
  82. that evolved from each other.  A new revision is
  83. created by manually editing an existing one.
  84. RCS organizes the revisions into an ancestral tree.  The initial revision
  85. is the root of the tree, and the tree edges indicate
  86. from which revision a given one evolved.
  87. Besides managing individual revision groups, RCS provides
  88. flexible selection functions for composing configurations.
  89. RCS may be combined with MAKE\u1\d,
  90. resulting in a powerful package for version control.
  91. .PP
  92. RCS also offers facilities for
  93. merging updates with customer modifications,
  94. for distributed software development, and
  95. for automatic identification.
  96. Identification is the `stamping'
  97. of revisions and configurations with unique markers.
  98. These markers are akin to serial numbers,
  99. telling software maintainers unambiguously which configuration
  100. is before them.
  101. .PP
  102. RCS is designed for both production and experimental
  103. environments.
  104. In production environments,
  105. access controls detect update conflicts and prevent overlapping changes.
  106. In experimental environments, where strong controls are
  107. counterproductive, it is possible to loosen the controls.
  108. .PP
  109. Although RCS was originally intended for programs, it is useful for any
  110. text that is revised frequently and whose previous revisions must be
  111. preserved.  RCS has been applied successfully to store the source
  112. text for drawings, VLSI layouts, documentation, specifications,
  113. test data, form letters and articles.
  114. .PP
  115. This paper discusses the practice of
  116. version control using RCS.
  117. It also introduces basic version control concepts,
  118. useful for clarifying current practice and designing similar systems.
  119. Revision groups of individual components are treated in the next three sections,
  120. and the extensions to configurations follow.
  121. Because of its size, a survey of version control tools
  122. appears at the end of the paper.
  123. .NH
  124. Getting started with RCS
  125. .PP
  126. Suppose a text file \fIf.c\fR is to be placed under control of RCS.
  127. Invoking the check-in command
  128. .D(
  129. ci  f.c
  130. .D)
  131. creates a new revision group with the contents of
  132. \fIf.c\fR as the initial
  133. revision (numbered 1.1)
  134. and stores the group into the file \fIf.c,v\fR.
  135. Unless told otherwise, the command deletes \fIf.c\fR.
  136. It also asks for a description of the group.
  137. The description should state the common purpose of all revisions in the group,
  138. and becomes part of the group's documentation.
  139. All later check-in commands will ask for a log entry,
  140. which should summarize the changes made.
  141. (The first revision is assigned a default log message,
  142. which just records the fact that it is the initial revision.)
  143. .PP
  144. Files ending in \fI,v\fR
  145. are called \fIRCS files\fR (\fIv\fR stands for \fIv\fRersions);
  146. the others are called working files.
  147. To get back the working file \fIf.c\fR in the previous example,
  148. execute the check-out command:
  149. .D(
  150. co  f.c
  151. .D)
  152. .R
  153. This command extracts the latest revision from
  154. the revision group \fIf.c,v\fR and writes
  155. it into \fIf.c\fR.
  156. The file \fIf.c\fR can now be edited and, when finished,
  157. checked back in with \fIci\fR:
  158. .D(
  159. ci  f.c
  160. .D)
  161. \fICi\fR assigns number 1.2 to
  162. the new revision.
  163. If \fIci\fR complains with the message
  164. .D(
  165. ci error: no lock set by <login>
  166. .D)
  167. then the system administrator has decided to configure RCS for a
  168. production environment by enabling the `strict locking feature'.
  169. If this feature is enabled, all RCS files are initialized
  170. such that check-in operations require a lock on the previous revision
  171. (the one from which the current one evolved).
  172. Locking prevents overlapping modifications if several people work on the same file.
  173. If locking is required, the revision should
  174. have been locked during the check-out by using
  175. the option \fI\-l\fR:
  176. .D(
  177. co  \-l  f.c
  178. .D)
  179. Of course it is too late now for the check-out with locking, because
  180. \fIf.c\fR has already been changed; checking out the file again
  181. would overwrite the modifications.
  182. (To prevent accidental overwrites, \fIco\fR senses the presence
  183. of a working file and asks whether the user really intended to overwrite it.
  184. The overwriting check-out is sometimes useful for
  185. backing up to the previous revision.)
  186. To be able to proceed with the check-in in the present case, first execute
  187. .D(
  188. rcs  \-l  f.c
  189. .D)
  190. This command retroactively locks the latest revision, unless someone
  191. else locked it in the meantime.  In this case, the two programmers
  192. involved have to negotiate whose
  193. modifications should take precedence.
  194. .PP
  195. If an RCS file is private, i.e., if only the owner of the file is expected
  196. to deposit revisions into it, the strict locking feature is unnecessary and
  197. may be disabled.
  198. If strict locking is disabled,
  199. the owner of the RCS file need not have a lock for check-in.
  200. For safety reasons, all others
  201. still do.  Turning strict locking off and on is done with the commands:
  202. .D(
  203. rcs  \-U  f.c       \fRand\fP         rcs  \-L  f.c
  204. .D)
  205. These commands enable or disable the strict locking feature for each RCS file
  206. individually.
  207. The system administrator only decides whether strict locking is
  208. enabled initially.
  209. .PP
  210. To reduce the clutter in a working directory, all RCS files can be moved
  211. to a subdirectory with the name \fIRCS\fR.
  212. RCS commands look first into that directory for RCS files.
  213. All the commands presented above work
  214. with the \fIRCS\fR subdirectory without change.\(dg
  215. .FS \(dg
  216. Pairs of RCS and working files can actually be specified in 3 ways:
  217. a) both are given, b) only the working file is given, c) only the
  218. RCS file is given.
  219. If a pair is given, both files may have arbitrary path prefixes;
  220. RCS commands pair them up intelligently.
  221. .FE
  222. .PP
  223. It may be undesirable that \fIci\fR deletes the working file.
  224. For instance, sometimes one would like to save the current revision,
  225. but continue editing.
  226. Invoking
  227. .D(
  228. ci  \-l  f.c
  229. .D)
  230. checks in \fIf.c\fR as usual, but performs an additional
  231. check-out with locking afterwards.  Thus, the working file does
  232. not disappear after the check-in.
  233. Similarly, the option
  234. \fI\-u\fR does a check-in followed by a check-out without
  235. locking.  This option is useful if the file is needed for compilation after the check-in.
  236. Both options update the identification markers in the working file
  237. (see below).
  238. .PP
  239. Besides the operations \fIci\fR and \fIco\fR, RCS provides the following
  240. commands:
  241. .sp 0
  242. .nr VS 12p
  243. .vs 12p
  244. .TS
  245. tab(%);
  246. li l.
  247. ident%extract identification markers
  248. rcs%change RCS file attributes
  249. rcsclean%remove unchanged working files (optional)
  250. rcsdiff%compare revisions
  251. rcsfreeze%record a configuration (optional)
  252. rcsmerge%merge revisions
  253. rlog%read log messages and other information in RCS files
  254. .TE
  255. A synopsis of these commands appears in the Appendix.
  256. .NH 2
  257. Automatic Identification
  258. .PP
  259. RCS can stamp source and object code with special identification strings,
  260. similar to product and serial numbers.
  261. To obtain such identification, place the marker
  262. .D(
  263. \*sId\*s
  264. .D)
  265. into the text of a revision, for instance inside a comment.
  266. The check-out operation will replace this marker with a string of the form
  267. .D(
  268. \*sId:  filename  revisionnumber  date  time  author  state  locker \*s
  269. .D)
  270. This string need never be touched, because \fIco\fR keeps it
  271. up to date automatically.
  272. To propagate the marker into object code, simply put
  273. it into a literal character string.  In C, this is done as follows:
  274. .D(
  275. static char rcsid[] = \&"\*sId\*s\&";
  276. .D)
  277. The command \fIident\fR extracts such markers from any file, in particular from
  278. object code.
  279. \fIIdent\fR helps to find out
  280. which revisions of which modules were used in a given program.
  281. It returns a complete and unambiguous component list,
  282. from which a copy of the program can be reconstructed.
  283. This facility is invaluable for program maintenance.
  284. .PP
  285. There are several additional identification markers, one for each component
  286. of \*sId\*s.
  287. The marker
  288. .D(
  289. \*sLog\*s
  290. .D)
  291. has a similar function.  It accumulates
  292. the log messages that are requested during check-in.
  293. Thus, one can maintain the complete history of a revision directly inside it,
  294. by enclosing it in a comment.
  295. Figure 1 is a partial reproduction of a log contained in revision 4.1 of
  296. the file \fIci.c\fR.  The log appears at the beginning of the file,
  297. and makes it easy to determine what the recent modifications were.
  298. .sp
  299. .nr VS 12p
  300. .vs 12p
  301. .ne 18
  302. .nf
  303. .in +0.5i
  304. /* \*sLog: ci.c,v \*s
  305.  * Revision 4.1  1983/05/10  17:03:06  wft
  306.  * Added option \-d and \-w, and updated assignment of date, etc. to new delta.
  307.  * Added handling of default branches.
  308.  *
  309.  * Revision 3.9  1983/02/15  15:25:44  wft
  310.  * Added call to fastcopy() to copy remainder of RCS file.
  311.  *
  312.  * Revision 3.8  1983/01/14  15:34:05  wft
  313.  * Added ignoring of interrupts while new RCS file is renamed;
  314.  * avoids deletion of RCS files by interrupts.
  315.  *
  316.  * Revision 3.7  1982/12/10  16:09:20  wft
  317.  * Corrected checking of return code from diff.
  318.  * An RCS file now inherits its mode during the first ci from the working file,
  319.  * except that write permission is removed.
  320.  */
  321. .in 0
  322. .ce 1
  323. Figure 1.  Log entries produced by the marker \*sLog\*s.
  324. .fi
  325. .nr VS 18p
  326. .vs 18p
  327. .sp 0
  328. .LP
  329. Since revisions are stored in the form of differences,
  330. each log message is
  331. physically stored once,
  332. independent of the number of revisions present.
  333. Thus, the \*sLog\*s marker incurs negligible space overhead.
  334. .NH
  335. The RCS Revision Tree
  336. .PP
  337. RCS arranges revisions in an ancestral tree.
  338. The \fIci\fR command builds this tree; the auxiliary command \fIrcs\fR
  339. prunes it.
  340. The tree has a root revision, normally numbered 1.1, and successive revisions
  341. are numbered 1.2, 1.3, etc.  The first field of a revision number
  342. is called the \fIrelease number\fR and the second one
  343. the \fIlevel number\fR.  Unless given explicitly,
  344. the \fIci\fR command assigns a new revision number
  345. by incrementing the level number of the previous revision.
  346. The release number must be incremented explicitly, using the
  347. \fI\-r\fR option of \fIci\fR.
  348. Assuming there are revisions 1.1, 1.2, and 1.3 in the RCS file f.c,v, the command
  349. .D(
  350. ci  \-r2.1  f.c       \fRor\fP       ci  \-r2  f.c
  351. .D)
  352. assigns the number 2.1 to the new revision.
  353. Later check-ins without the \fI\-r\fR option will assign the numbers 2.2, 2.3,
  354. and so on.
  355. The release number should be incremented only at major transition points
  356. in the development, for instance when a new release of a software product has
  357. been completed.
  358. .NH 2
  359. When are branches needed?
  360. .PP
  361. A young revision tree is slender:
  362. It consists of only one branch, called the trunk.
  363. As the tree ages, side branches may form.
  364. Branches are needed in the following 4 situations.
  365. .IP "\fITemporary fixes\fR"
  366. .sp 0
  367. Suppose a tree has 5 revisions grouped in 2 releases,
  368. as illustrated in Figure 2.
  369. Revision 1.3, the last one of release 1, is in operation at customer sites,
  370. while release 2 is in active development.
  371. .ne 4
  372. .PS 4i
  373. .ps -2
  374. box "1.1"
  375. arrow
  376. box "1.2"
  377. arrow
  378. box "1.3"
  379. arrow
  380. box "2.1"
  381. arrow
  382. box "2.2"
  383. arrow dashed
  384. .ps +2
  385. .PE
  386. .ce 1
  387. Figure 2.  A slender revision tree.
  388. .sp 0
  389. Now imagine a customer requesting a fix of
  390. a problem in revision 1.3, although actual development has moved on
  391. to release 2.  RCS does not permit an extra
  392. revision to be spliced in between 1.3 and 2.1, since that would not reflect
  393. the actual development history.  Instead, create a branch
  394. at revision 1.3, and check in the fix on that branch.
  395. The first branch starting at 1.3 has number 1.3.1, and
  396. the revisions on that branch are numbered 1.3.1.1, 1.3.1.2, etc.
  397. The double numbering is needed to allow for another
  398. branch at 1.3, say 1.3.2.
  399. Revisions on the second branch would be numbered
  400. 1.3.2.1, 1.3.2.2, and so on.
  401. The following steps create
  402. branch 1.3.1 and add revision 1.3.1.1:
  403. .sp 0
  404. .I
  405. .nr VS 12p
  406. .vs 12p
  407. .TS
  408. tab(%);
  409. l l l.
  410.      %co  \-r1.3  f.c% \*- check out revision 1.3
  411.      %edit  f.c% \*- change it
  412.      %ci  \-r1.3.1  f.c% \*- check it in on branch 1.3.1
  413. .TE
  414. .nr VS 18p
  415. .vs 18p
  416. .R
  417. This sequence of commands transforms the tree of Figure 2 into
  418. the one in Figure 3.
  419. Note that it may be necessary to incorporate the differences
  420. between 1.3 and 1.3.1.1
  421. into a revision at level 2.  The operation \fIrcsmerge\fR automates this
  422. process (see the Appendix).
  423. .ne 7
  424. .PS  4i
  425. .ps -2
  426.      box "1.1"
  427.      arrow
  428.      box "1.2"
  429.      arrow
  430. R13: box "1.3"
  431.      arrow
  432. R21: box "2.1"
  433.      arrow
  434. R22: box "2.2"
  435.      arrow dashed
  436.      line invis down from R21.s
  437. RB1: box "1.3.1.1"
  438.      arrow dashed right from RB1.e
  439.      arrow from R13.s to RB1.w
  440. .ps +2
  441. .PE
  442. .ce 1
  443. Figure 3.  A revision tree with one side branch
  444. .sp
  445. .IP "\fIDistributed development and customer modifications\fR"
  446. .sp 0
  447. Assume a situation as in Figure 2, where revision 1.3 is in operation
  448. at several customer sites,
  449. while release 2 is in development.
  450. Customer sites should use RCS to store the distributed software.
  451. However, customer modifications should not be placed on the same branch
  452. as the distributed source; instead, they should be placed on a side branch.
  453. When the next software distribution arrives,
  454. it should be appended to the trunk of
  455. the customer's RCS file, and the customer
  456. can then merge the local modifications back into the new release.
  457. In the above example, a
  458. customer's RCS file would contain the following tree, assuming
  459. that the customer has received revision 1.3, added his local modifications
  460. as revision 1.3.1.1, then received revision 2.4, and merged
  461. 2.4 and 1.3.1.1, resulting in 2.4.1.1.
  462. .ne 7
  463. .PS  4i
  464. .ps -2
  465. R13: box "1.3"
  466.      line invis
  467. R21: box invis
  468.      line invis
  469. R22: box invis
  470.      line invis
  471. R24: box "2.4"
  472.      line invis
  473. R25: box invis
  474.      line invis
  475.      arrow from R13.e to R24.w
  476.      line invis down from R21.s
  477. RB1: box "1.3.1.1"
  478.      arrow from R13.s to RB1.w
  479.      right
  480.      line invis down from R25.s
  481. RB2: box "2.4.1.1"
  482.      arrow from R24.s to RB2.w
  483. .ps +2
  484. .PE
  485. .ce 1
  486. Figure 4.  A customer's revision tree with local modifications.
  487. .sp 1
  488. This approach is actually practiced in the CSNET project,
  489. where several universities and a company cooperate
  490. in developing a national computer network.
  491. .IP "\fIParallel development\fR"
  492. .sp 0
  493. Sometimes it is desirable to explore an alternate design or
  494. a different implementation technique in parallel with the
  495. main line development.  Such development
  496. should be carried out on a side branch.
  497. The experimental changes may later be moved into the main line, or abandoned.
  498. .IP "\fIConflicting updates\fR"
  499. .sp 0
  500. A common occurrence is that one programmer
  501. has checked out a revision, but cannot complete the assignment
  502. for some reason.  In the meantime, another person
  503. must perform another modification
  504. immediately.  In that case, the second person should check-out the same revision,
  505. modify it, and check it in on a side branch, for later merging.
  506. .PP
  507. Every node in a revision tree consists of the following attributes:
  508. a revision number, a check-in date and time, the author's identification,
  509. a log entry, a state and the actual text.  All these attributes
  510. are determined at the time the revision is checked in.
  511. The state attribute indicates the status of a revision.
  512. It is set automatically to `experimental' during check-in.
  513. A revision can later be promoted to a higher status, for example
  514. `stable' or `released'.  The set of states is user-defined.
  515. .NH 2
  516. Revisions are represented as deltas
  517. .PP
  518. For conserving space, RCS stores revisions in the form
  519. of deltas, i.e., as differences between revisions.
  520. The user interface completely hides this fact.
  521. .PP
  522. A delta is a sequence of edit commands that transforms one string
  523. into another.  The deltas employed by RCS are line-based, which means
  524. that the only edit commands allowed are insertion and deletion of lines.
  525. If a single character in a line is changed, the
  526. edit scripts consider the entire line changed.
  527. The program \fIdiff\fR\u2\d
  528. produces a small, line-based delta between pairs of text files.
  529. A character-based edit script would take much longer to compute,
  530. and would not be significantly shorter.
  531. .PP
  532. Using deltas is a classical space-time tradeoff: deltas reduce the
  533. space consumed, but increase access time.
  534. However, a version control tool should impose as little delay
  535. as possible on programmers.
  536. Excessive delays discourage the use of version controls,
  537. or induce programmers to take shortcuts that compromise system integrity.
  538. To gain reasonably fast access time for both editing and compiling,
  539. RCS arranges deltas in the following way.
  540. The most recent revision on the trunk is stored intact.
  541. All other revisions on the trunk are stored as reverse deltas.
  542. A reverse delta describes how to go backward in the development history:
  543. it produces the desired revision if applied to the successor of that revision.
  544. This implementation has the advantage
  545. that extraction of the latest revision is a simple and fast copy
  546. operation.
  547. Adding a new revision to the trunk is also fast: \fIci\fR simply
  548. adds the new revision intact, replaces the previous
  549. revision with a reverse delta, and keeps the rest of the old deltas.
  550. Thus, \fIci\fR requires the computation
  551. of only one new delta.
  552. .PP
  553. Branches need special treatment.  The naive solution would be to
  554. store complete copies for the tips of all branches.
  555. Clearly, this approach would cost too much space.  Instead,
  556. RCS uses \fIforward\fR deltas for branches.  Regenerating a revision
  557. on a side branch proceeds as follows.  First, extract the latest revision
  558. on the trunk; secondly, apply reverse deltas until the fork revision for
  559. the branch is obtained; thirdly, apply forward deltas until the desired
  560. branch revision is reached.  Figure 5 illustrates a tree with
  561. one side branch.  Triangles pointing to the left and right represent
  562. reverse and forward deltas, respectively.
  563. .ne 8
  564. .PS  4i
  565. .ps -2
  566. define BD X [line invis $1 right .5;
  567. line up .3 then left .5 down .3 then right .5 down .3 then up .3] X
  568.  
  569. define FD X [line invis $1 right .5;
  570. line left .5 down .3 then up .6 then right .5 down .3;] X
  571.  
  572. right
  573. D11:    BD(" 1.1")
  574.     arrow right from D11.e
  575. D12:    BD(" 1.2")
  576.     arrow  right from D12.e
  577. D13:    BD(" 1.3")
  578.     arrow  right from D13.e
  579. D21:    BD(" 2.1")
  580.     arrow  right from D21.e
  581. D22:    box "2.2"
  582.     line invis down from D21.s
  583. F1:     FD("1.3.1.1 ")
  584.     arrow from D13.se to F1.w
  585.     arrow from F1.e right
  586.     right
  587. F2:     FD("1.3.1.2 ")
  588. .ps +2
  589. .PE
  590. .ce 1
  591. Figure 5.  A revision tree with reverse and forward deltas.
  592. .sp 0
  593. .PP
  594. Although implementing fast check-out for the latest trunk revision,
  595. this arrangement has the disadvantage that generation of other revisions
  596. takes time proportional to the number of deltas applied.  For example,
  597. regenerating the branch tip in Figure 5 requires application of five
  598. deltas (including the initial one).  Since usage statistics show that
  599. the latest trunk revision is the one that is retrieved in 95 per cent
  600. of all cases (see the section on usage statistics), biasing check-out time
  601. in favor of that revision results in significant savings.
  602. However, careful implementation of the delta application process is
  603. necessary to provide low retrieval overhead for other revisions, in
  604. particular for branch tips.
  605. .PP
  606. There are several techniques for delta application.
  607. The naive one is to pass each delta to a general-purpose text editor.
  608. A prototype of RCS invoked the UNIX editor \fIed\fR both
  609. for applying deltas and for expanding the identification markers.
  610. Although easy to implement, performance was poor, owing to the
  611. high start-up costs and excess generality of \fIed\fR.  An intermediate
  612. version of RCS used a special-purpose, stream-oriented editor.
  613. This technique reduced the cost of applying a delta to the cost of
  614. checking out the latest trunk revision.  The reason for this behavior
  615. is that each delta application involves a complete pass over
  616. the preceding revision.
  617. .PP
  618. However, there is a much better algorithm.  Note that the deltas are
  619. line oriented and that most of the work of a stream editor involves
  620. copying unchanged lines from one revision to the next.  A faster
  621. algorithm avoids unnecessary copying of character strings by using
  622. a \fIpiece table\fR.
  623. A piece table is a one-dimensional array, specifying how a given
  624. revision is `pieced together' from lines in the RCS file.
  625. Suppose piece table \fIPT\dr\u\fR represents revision \fIr\fR.
  626. Then \fIPT\dr\u[i]\fR contains the starting position of line \fIi\fR
  627. of revision \fIr\fR.
  628. Application of the next delta transforms piece table \fIPT\dr\u\fR
  629. into \fIPT\dr+1\u\fR.  For instance, a delete command removes a
  630. series of entries from the piece table.  An insertion command inserts
  631. new entries, moving the entries following the insertion point further down the
  632. array.  The inserted entries point to the text lines in the delta.
  633. Thus, no I/O is involved except for reading the delta itself.  When all
  634. deltas have been applied to the piece table, a sequential pass
  635. through the table looks up each line in the RCS file and copies it to
  636. the output file, updating identification markers at the same time.
  637. Of course, the RCS file must permit random access, since the copied
  638. lines are scattered throughout that file.  Figure 6 illustrates an
  639. RCS file with two revisions and the corresponding piece tables.
  640. .ne 13
  641. .sp 6
  642. .ce 1
  643. \fIFigure 6 is not available.\fP
  644. .sp 5
  645. .ce 1
  646. Figure 6.  An RCS file and its piece tables
  647. .sp 0
  648. .PP
  649. The piece table approach has the property that the time for applying a single
  650. delta is roughly determined by the size of the delta, and not by the
  651. size of the revision.  For example, if a delta is
  652. 10 per cent of the size of a revision, then applying it takes only
  653. 10 per cent of the time to generate the latest trunk revision.  (The stream
  654. editor would take 100 per cent.)
  655. .PP
  656. There is an important alternative for representing deltas that affects
  657. performance.  SCCS\u3\d,
  658. a precursor of RCS, uses \fIinterleaved\fR deltas.
  659. A file containing interleaved deltas is partitioned into blocks of lines.
  660. Each block has a header that specifies to which revision(s) the block
  661. belongs.  The blocks are sorted out in such a way that a single
  662. pass over the file can pick up all the lines belonging to a given
  663. revision.  Thus, the regeneration time for all revisions is the same:
  664. all headers must be inspected, and the associated blocks either copied
  665. or skipped.  As the number of revisions increases, the cost of retrieving
  666. any revision is much higher than the cost of checking out the
  667. latest trunk revision with reverse deltas.  A detailed comparison
  668. of SCCS's interleaved deltas and RCS's reverse deltas can be found
  669. in Reference 4.
  670. This reference considers the version of RCS with the
  671. stream editor only.  The piece table method improves performance
  672. further, so that RCS is always faster than SCCS, except if 10
  673. or more deltas are applied.
  674. .PP
  675. Additional speed-up for both delta methods can be obtained by caching
  676. the most recently generated revision, as has been implemented in DSEE.\u5\d
  677. With caching, access time to frequently used revisions can approach normal file
  678. access time, at the cost of some additional space.
  679. .NH
  680. Locking: A Controversial Issue
  681. .PP
  682. The locking mechanism for RCS was difficult to design.
  683. The problem and its solution are first presented in their `pure' form,
  684. followed by a discussion of the complications
  685. caused by `real-world' considerations.
  686. .PP
  687. RCS must prevent two or more persons from depositing competing changes of the
  688. same revision.
  689. Suppose two programmers check out revision 2.4 and
  690. modify it.  Programmer A checks in a revision before programmer B\&.
  691. Unfortunately, programmer B has not seen A's
  692. changes, so the effect is that A's changes are covered up by B's deposit.
  693. A's changes are not lost since all revisions
  694. are saved, but they are confined to a single revision.\(dd
  695. .FS \(dd
  696. Note that this problem is entirely different from the atomicity problem.
  697. Atomicity means that
  698. concurrent update operations on the same RCS file cannot be permitted,
  699. because that may result in inconsistent data.
  700. Atomic updates are essential (and implemented in RCS),
  701. but do not solve the conflict discussed here.
  702. .FE
  703. .PP
  704. This conflict is prevented in RCS by locking.
  705. Whenever someone intends to edit a revision (as opposed
  706. to reading or compiling it), the revision should be checked out
  707. and locked,
  708. using the \fI\-l\fR option on \fIco\fR.  On subsequent check-in,
  709. \fIci\fR tests the lock and then removes it.
  710. At most one programmer at a time may
  711. lock a particular revision, and only this programmer may check in
  712. the succeeding revision.
  713. Thus, while a revision is locked, it is the exclusive responsibility
  714. of the locker.
  715. .PP
  716. An important maxim for software tools like RCS is that they must
  717. not stand in the way of making progress with a project.
  718. This consideration leads to several weakenings of the locking mechanism.
  719. First of all, even if a revision is locked, it can
  720. still be checked out.  This is necessary if other people
  721. wish to compile or inspect the locked revision
  722. while the next one is in preparation.  The only operations they
  723. cannot do are to lock the revision or to check in the succeeding one.  Secondly,
  724. check-in operations on other branches in the RCS file are still possible; the
  725. locking of one revision does not affect any other revision.
  726. Thirdly, revisions are occasionally locked for a long period of time
  727. because a programmer is absent or otherwise unable to complete
  728. the assignment.  If another programmer has to make a pressing change,
  729. there are the following three alternatives for making progress:
  730. a) find out who is holding the lock and ask that person to release it;
  731. b) check out the locked revision, modify it, check it
  732. in on a branch, and merge the changes later;
  733. c) break the lock.  Breaking a lock leaves a highly visible
  734. trace, namely an electronic mail message that is sent automatically to the
  735. holder of the lock, recording the breaker and a commentary requested from him.
  736. Thus, breaking locks is tolerated under certain circumstances,
  737. but will not go unnoticed.
  738. Experience has shown that the automatic mail message attaches a high enough
  739. stigma to lock breaking,
  740. such that programmers break locks only in real emergencies,
  741. or when a co-worker resigns and leaves locked revisions behind.
  742. .PP
  743. If an RCS file is private, i.e., when a programmer owns an RCS file
  744. and does not expect anyone else to perform check-in operations,
  745. locking is an unnecessary nuisance.
  746. In this case,
  747. the `strict locking feature' discussed earlier may be disabled,
  748. provided that file protection
  749. is set such that only the owner may write the RCS file.
  750. This has the effect that only the owner can check-in revisions,
  751. and that no lock is needed for doing so.
  752. .PP
  753. As added protection,
  754. each RCS file contains an access list that specifies the users
  755. who may execute update operations.  If an access list is empty,
  756. only normal UNIX file protection applies.  Thus, the access list is
  757. useful for restricting the set of people who would otherwise have update
  758. permission.  Just as with locking, the access list
  759. has no effect on read-only operations such as \fIco\fR.  This approach
  760. is consistent with the UNIX philosophy of openness, which contributes
  761. to a productive software development environment.
  762. .NH
  763. Configuration Management
  764. .PP
  765. The preceding sections described how RCS deals with revisions of individual
  766. components; this section discusses how to handle configurations.
  767. A configuration is a set of revisions, where each revision comes
  768. from a different revision group, and the revisions are selected
  769. according to a certain criterion.
  770. For example,
  771. in order to build a functioning compiler, the `right'
  772. revisions from the scanner, the parser, the optimizer
  773. and the code generator must be combined.
  774. RCS, in conjunction with MAKE,
  775. provides a number of facilities to effect a smooth selection.
  776. .NH 2
  777. RCS Selection Functions
  778. .PP
  779. .IP "\fIDefault selection\fR"
  780. .sp 0
  781. During development, the usual selection criterion is to choose
  782. the latest revision of all components.  The \fIco\fR command
  783. makes this selection by default.  For example, the command
  784. .D(
  785. co  *,v
  786. .D)
  787. retrieves the latest revision on the default branch of each RCS file
  788. in the current directory.
  789. The default branch is usually the trunk, but may be
  790. set to be a side branch.
  791. Side branches as defaults are needed in distributed software development,
  792. as discussed in the section on the RCS revision tree.
  793. .sp
  794. .IP "\fIRelease based selection\fR"
  795. .sp 0
  796. Specifying a release or branch number selects the latest revision in
  797. that release or branch.
  798. For instance,
  799. .D(
  800. co  \-r2  *,v
  801. .D)
  802. retrieves the latest revision with release number 2 from each RCS file.
  803. This selection is convenient if a release has been completed and
  804. development has moved on to the next release.
  805. .sp
  806. .IP "\fIState and author based selection\fR"
  807. .sp 0
  808. If the highest level number within a given release number
  809. is not the desired one,
  810. the state attribute can help.  For example,
  811. .D(
  812. co  \-r2  \-sReleased  *,v
  813. .D)
  814. retrieves the latest revision with release number 2 whose state attribute
  815. is `Released'.
  816. Of course, the state attribute has to be set appropriately, using the
  817. \fIci\fR or \fIrcs\fR commands.
  818. Another alternative is to select a revision by its author,
  819. using the \fI\-w\fR option.
  820. .sp
  821. .IP "\fIDate based selection\fR"
  822. .sp 0
  823. Revisions may also be selected by date.
  824. Suppose a release of an entire system was
  825. completed and current on March 4, at 1:00 p.m. local time.  Then the command
  826. .D(
  827. co  \-d'March 4, 1:00 pm LT'  *,v
  828. .D)
  829. checks out all the components of that release, independent of the numbering.
  830. The \fI\-d\fR option specifies a `cutoff date', i.e.,
  831. the revision selected has a check-in date that
  832. is closest to, but not after the date given.
  833. .IP "\fIName based selection\fR"
  834. .sp 0
  835. The most powerful selection function is based on assigning symbolic
  836. names to revisions and branches.
  837. In large systems, a single release number or date is not sufficient
  838. to collect the appropriate revisions from all groups.
  839. For example, suppose one wishes to combine release 2
  840. of one subsystem and release 15 of another.
  841. Most likely, the creation dates of those releases differ also.
  842. Thus, a single revision number or date passed to the \fIco\fR command
  843. will not suffice to select the right revisions.
  844. Symbolic revision numbers solve this problem.
  845. Each RCS file may contain a set of symbolic names that are mapped
  846. to numeric revision numbers.  For example, assume
  847. the symbol \fIV3\fR is bound to release number 2 in file \fIs,v\fR, and to
  848. revision number 15.9 in \fIt,v\fR.
  849. Then the single command
  850. .D(
  851. co  \-rV3  s,v  t,v
  852. .D)
  853. retrieves the latest revision of release 2 from \fIs,v\fR,
  854. and revision 15.9 from \fIt,v\fR.
  855. In a large system with many modules, checking out all
  856. revisions with one command greatly simplifies configuration management.
  857. .PP
  858. Judicious use of symbolic revision numbers helps with organizing
  859. large configurations.
  860. A special command, \fIrcsfreeze\fR,
  861. assigns a symbolic revision number to a selected revision
  862. in every RCS file.
  863. \fIRcsfreeze\fR effectively freezes a configuration.
  864. The assigned symbolic revision number selects all components
  865. of the configuration.
  866. If necessary, symbolic numbers
  867. may even be intermixed with numeric ones.  Thus, \fIV3.5\fR in the
  868. above example
  869. would select revision 2.5 in \fIs,v\fR and branch 15.9.5 in \fIt,v\fR.
  870. .PP
  871. The options \fI\-r\fR, \fI\-s\fR, \fI\-w\fR and \fI\-d\fR
  872. may be combined.  If a branch is given, the latest revision
  873. on that branch satisfying all conditions is retrieved;
  874. otherwise, the default branch is used.
  875. .NH 2
  876. Combining MAKE and RCS
  877. .PP
  878. MAKE\u1\d
  879. is a program that processes configurations.
  880. It is driven by configuration specifications
  881. recorded in a special file, called a `Makefile'.
  882. MAKE avoids redundant processing steps
  883. by comparing creation dates of source and processed objects.
  884. For example, when instructed to compile all
  885. modules of a given system, it only recompiles
  886. those source modules that were changed
  887. since they were processed last.
  888. .PP
  889. MAKE has been extended with an auto-checkout feature for RCS.*
  890. .FS *
  891. This auto-checkout extension is available only in some versions of MAKE,
  892. e.g. GNU MAKE.
  893. .FE
  894. When a certain file to be processed is not present,
  895. MAKE attempts a check-out operation.
  896. If successful, MAKE performs the required processing, and then deletes
  897. the checked out file to conserve space.
  898. The selection parameters discussed above can be passed to MAKE
  899. either as parameters, or directly embedded in the Makefile.
  900. MAKE has also been extended to search the subdirectory named \fIRCS\fR
  901. for needed files, rather than just the current working directory.
  902. However, if a working file is present, MAKE totally ignores the corresponding
  903. RCS file and uses the working file.
  904. (In newer versions of MAKE distributed by AT&T and others,
  905. auto-checkout can be
  906. achieved with the rule DEFAULT, instead of a special extension of MAKE.
  907. However, a file checked out by the rule DEFAULT
  908. will not be deleted after processing. \fIRcsclean\fR can be
  909. used for that purpose.)
  910. .PP
  911. With auto-checkout, RCS/MAKE can effect a selection rule
  912. especially tuned for multi-person software development and maintenance.
  913. In these situations,
  914. programmers should obtain configurations that consist of
  915. the revisions they have personally checked out plus the latest
  916. checked in revision of all other revision groups.
  917. This schema can be set up as follows.
  918. .PP
  919. Each programmer chooses a working directory
  920. and places into it a symbolic link, named \fIRCS\fR,
  921. to the directory containing the relevant RCS files.
  922. The symbolic link makes sure that \fIco\fR and \fIci\fR
  923. operations need only specify the working files, and that
  924. the Makefile need not be changed.
  925. The programmer then checks out the needed files and modifies them.
  926. If MAKE is invoked,
  927. it composes configurations by selecting those
  928. revisions that are checked out, and the rest from the
  929. subdirectory \fIRCS\fR.
  930. The latter selection may be controlled by a symbolic
  931. revision number or any of the other selection criteria.
  932. If there are several programmers editing in separate working directories,
  933. they are insulated from each other's changes until checking in their
  934. modifications.
  935. .PP
  936. Similarly, a maintainer can recreate an older configuration
  937. by starting to work in an empty working directory.
  938. During the initial MAKE invocation, all revisions are selected from RCS files.
  939. As the maintainer checks out files and modifies them,
  940. a new configuration is gradually built up.
  941. Every time MAKE is invoked, it substitutes the modified revisions
  942. into the configuration being manipulated.
  943. .PP
  944. A final application of RCS is to use it for storing Makefiles.
  945. Revision groups of Makefiles represent
  946. multiple versions of configurations.
  947. Whenever a configuration is baselined or distributed,
  948. the best approach is to unambiguously fix
  949. the configuration with a symbolic revision number by calling
  950. \fIrcsfreeze\fR,
  951. to embed that symbol into the Makefile, and to
  952. check in the Makefile (using the same symbolic revision number).
  953. With this approach, old configurations
  954. can be regenerated easily and reliably.
  955. .NH
  956. Usage Statistics
  957. .PP
  958. The following usage statistics were collected on two DEC VAX-11/780
  959. computers of the Purdue Computer Science Department.  Both machines
  960. are mainly used for research purposes.  Thus, the data
  961. reflect an environment in which the majority of projects
  962. involve prototyping and advanced software development,
  963. but relatively little long-term maintenance.
  964. .PP
  965. For the first experiment,
  966. the \fIci\fR and \fIco\fR operations were instrumented
  967. to log the number of backward and forward deltas applied.
  968. The data were collected during a 13 month period
  969. from Dec. 1982 to Dec. 1983.
  970. Table I summarizes the results.
  971. .sp 0
  972. .nr VS 12p
  973. .vs 12p
  974. .TS
  975. center,box,tab(#);
  976. c|c|c|c|c s|c s
  977. c|c|c|c|c s|c s
  978. l|n|n|n|n n|n n.
  979. Operation#Total#Total deltas#Mean deltas#Operations#Branch
  980.      #operations #applied#applied#with >1 delta#operations
  981. _
  982. co     # 7867# 9320#1.18#509#(6%)#203#(3%)
  983. ci     # 3468# 2207#0.64# 85#(2%)# 75#(2%)
  984. ci & co#11335#11527#1.02#594#(5%)#278#(2%)
  985. .TE
  986. .ce 1
  987. Table I.  Statistics for \fIco\fR and \fIci\fR operations.
  988. .nr VS 18p
  989. .vs 18p
  990. .PP
  991. The first two lines show statistics for check-out and check-in;
  992. the third line shows the combination.
  993. Recall that \fIci\fR performs an implicit check-out to obtain
  994. a revision for computing the delta.
  995. In all measures presented, the most recent revision (stored intact)
  996. counts as one delta.  The number of deltas applied represents
  997. the number of passes necessary, where the first `pass' is a copying step.
  998. .PP
  999. Note that the check-out operation is executed more than
  1000. twice as frequently as the check-in operation.
  1001. The fourth column gives the mean number of deltas
  1002. applied in all three cases.
  1003. For \fIci\fR, the mean number of deltas applied is less
  1004. than one.
  1005. The reasons are that the initial check-in requires no delta at all, and that
  1006. the only time \fIci\fR requires more than one delta is for branches.
  1007. Column 5 shows the actual number of operations that applied more than one
  1008. delta.
  1009. The last column indicates that branches were not used often.
  1010. .PP
  1011. The last three columns demonstrate that the most recent trunk revision
  1012. is by far the most frequently accessed.
  1013. For RCS, check-out of
  1014. this revision is a simple copy operation, which is the absolute minimum
  1015. given the copy-semantics of \fIco\fR.
  1016. Access to older revisions and branches
  1017. is more common in non-academic environments,
  1018. yet even if access to older deltas were an order
  1019. of magnitude more frequent,
  1020. the combined average number of deltas applied would still be below 1.2.
  1021. Since RCS is faster than SCCS until up to 10 delta applications,
  1022. reverse deltas are clearly the method of choice.
  1023. .PP
  1024. The second experiment, conducted in March of 1984,
  1025. involved surveying the existing RCS files
  1026. on our two machines.  The goal was to determine the mean number of
  1027. revisions per RCS file, as well as the space consumed by them.
  1028. Table II shows the results.  (Tables I and II were produced at different
  1029. times and are unrelated.)
  1030. .sp 0
  1031. .nr VS 12p
  1032. .vs 12p
  1033. .TS
  1034. center,box,tab(#);
  1035. c | c | c | c | c | c | c
  1036. c | c | c | c | c | c | c
  1037. l | n | n | n | n | n | n.
  1038.       #Total RCS#Total#Mean#Mean size of#Mean size of#Overhead
  1039.       #files#revisions#revisions#RCS files#revisions
  1040. _
  1041. All files #8033#11133#1.39#6156#5585#1.10
  1042. Files with#1477# 4578#3.10#8074#6041#1.34
  1043. \(>= 2 deltas
  1044. .TE
  1045. .ce 1
  1046. Table II.  Statistics for RCS files.
  1047. .nr VS 18p
  1048. .vs 18p
  1049. .PP
  1050. The mean number of revisions per RCS file is 1.39.
  1051. Columns 5 and 6 show the mean sizes (in bytes) of an RCS file
  1052. and of the latest revision of each RCS file, respectively.
  1053. The `overhead' column contains the ratio of the mean sizes.
  1054. Assuming that all revisions in an RCS file are approximately the same size,
  1055. this ratio gives a measure of the space consumed by the extra revisions.
  1056. .PP
  1057. In our sample, over 80 per cent of the RCS files contained only a single revision.
  1058. The reason is that our
  1059. systems programmers routinely check in all source files
  1060. on the distribution tapes, even though they may never touch them again.
  1061. To get a better indication of how much space savings are possible
  1062. with deltas, all measures with those files
  1063. that contained 2 or more revisions were recomputed.  Only for those files
  1064. is RCS necessary.
  1065. As shown in the second line, the average number of revisions for those files is
  1066. 3.10, with an overhead of 1.34.  This means that the extra 2.10 deltas
  1067. require 34 per cent extra space, or
  1068. 16 per cent per extra revision.
  1069. Rochkind\u3\d
  1070. measured the space consumed by SCCS, and
  1071. reported an average of 5 revisions per group
  1072. and an overhead of 1.37 (or about 9 per cent per extra revision).
  1073. In a later paper, Glasser\u6\d
  1074. observed an average of 7 revisions per group in a single, large project,
  1075. but provided no overhead figure.
  1076. In his paper on DSEE\u5\d,
  1077. Leblang reported that delta storage combined with blank compression
  1078. results in an overhead of a mere 1\-2 per cent per revision.
  1079. Since leading blanks accounted for about 20 per cent of the surveyed Pascal
  1080. programs, a revision group with 5\-10 members was smaller
  1081. than a single cleartext copy.
  1082. .PP
  1083. The above observations demonstrate clearly that the space needed
  1084. for extra revisions is small.  With delta storage, the luxury of
  1085. keeping multiple revisions online is certainly affordable.
  1086. In fact, introducing a system with delta storage may reduce
  1087. storage requirements, because programmers often save back-up copies
  1088. anyway.  Since back-up copies are stored much more efficiently with deltas,
  1089. introducing a system such as RCS may
  1090. actually free a considerable amount of space.
  1091. .NH
  1092. Survey of Version Control Tools
  1093. .PP
  1094. The need to keep back-up copies of software arose when
  1095. programs and data were no longer stored on paper media, but were entered
  1096. from terminals and stored on disk.
  1097. Back-up copies are desirable for reliability, and many modern editors
  1098. automatically save a back-up copy for every file touched.
  1099. This strategy
  1100. is valuable for short-term back-ups, but not suitable for long-term
  1101. version control, since an existing back-up copy is overwritten whenever the
  1102. corresponding file is edited.
  1103. .PP
  1104. Tape archives are suitable for long-term, offline storage.
  1105. If all changed files are dumped on a back-up tape once per day, old revisions
  1106. remain accessible.  However, tape archives are unsatisfactory
  1107. for version control in several ways.  First, backing up the file
  1108. system every 24 hours does not capture intermediate revisions.
  1109. Secondly, the old revisions are not online,
  1110. and accessing them is tedious and time-consuming.
  1111. In particular, it is impractical to
  1112. compare several old revisions of a group,
  1113. because that may require mounting and searching several tapes.
  1114. Tape archives are important fail-safe tools in the
  1115. event of catastrophic disk failures or accidental deletions,
  1116. but they are ill-suited for version control.
  1117. Conversely, version control tools do not obviate the
  1118. need for tape archives.
  1119. .PP
  1120. A natural technique for keeping several old revisions online is
  1121. to never delete a file.
  1122. Editing a file
  1123. simply creates a new file with the same
  1124. name, but with a different sequence number.
  1125. This technique, available as an option in DEC's VMS operating system,
  1126. turns out to be inadequate for version control.
  1127. First, it is prohibitively expensive in terms of storage costs,
  1128. especially since no data compression techniques are employed.
  1129. Secondly, indiscriminately storing every change produces too many
  1130. revisions, and programmers have difficulties distinguishing them.
  1131. The proliferation of revisions forces programmers to spend much time on
  1132. finding and deleting useless files.
  1133. Thirdly, most of the support functions like locking, logging,
  1134. revision selection,
  1135. and identification described in this paper are not available.
  1136. .PP
  1137. An alternative approach is to separate editing from revision control.
  1138. The user may repeatedly edit a given revision,
  1139. until freezing it with an explicit command.
  1140. Once a revision is frozen, it is stored permanently and can no longer be modified.
  1141. (In RCS, freezing a revisions is done with \fIci\fR.)
  1142. Editing a frozen revision implicitly creates a new one, which
  1143. can again be changed repeatedly until it is frozen itself.
  1144. This approach saves exactly those revisions that the user
  1145. considers important, and keeps the number of revisions manageable.
  1146. IBM's CLEAR/CASTER\u7\d,
  1147. AT&T's SCCS\u3\d,
  1148. CMU's SDC\u8\d
  1149. and DEC's CMS\u9\d,
  1150. are examples of version control systems using this approach.
  1151. CLEAR/CASTER maintains a data base of programs, specifications,
  1152. documentation and messages, using deltas.
  1153. Its goal is to provide control over the development process from a
  1154. management viewpoint.
  1155. SCCS stores multiple revisions of source text in an ancestral tree,
  1156. records a log entry for each revision,
  1157. provides access control, and has facilities
  1158. for uniquely identifying each revision.
  1159. An efficient delta technique
  1160. reduces the space consumed by each revision group.
  1161. SDC is much simpler than SCCS because it stores not more than
  1162. two revisions.  However, it maintains a complete log for all old
  1163. revisions, some of which may be on back-up tape.
  1164. CMS, like SCCS, manages tree-structured revision groups,
  1165. but offers no identification mechanism.
  1166. .PP
  1167. Tools for dealing with configurations are still in a state of flux.
  1168. SCCS, SDC and CMS can be combined with MAKE or MAKE-like programs.
  1169. Since flexible selection rules are missing from all these tools,
  1170. it is sometimes difficult
  1171. to specify precisely which revision of each group
  1172. should be passed to MAKE for building a desired configuration.
  1173. The Xerox Cedar system\u10\d
  1174. provides a `System Modeller' that can rebuild
  1175. a configuration from an arbitrary set of module revisions.
  1176. The revisions of a module are only distinguished by creation time,
  1177. and there is no tool for managing groups.
  1178. Since the selection rules are primitive,
  1179. the System Modeller appears to be somewhat tedious to use.
  1180. Apollo's DSEE\u5\d
  1181. is a sophisticated software engineering environment.
  1182. It manages revision groups in a way similar to SCCS and CMS.  Configurations
  1183. are built using `configuration threads'.
  1184. A configuration thread states which revision of each group
  1185. named in a configuration should be chosen.
  1186. A configuration thread may contain dynamic specifiers
  1187. (e.g., `choose the revisions I am currently working on,
  1188. and the most recent revisions otherwise'), which are bound
  1189. automatically at build time.
  1190. It also provides a notification mechanism for alerting
  1191. maintainers about the need to rebuild a system after a change.
  1192. .PP
  1193. RCS is based on a general model for describing
  1194. multi-version/multi-configuration systems\u11\d.
  1195. The model describes systems using AND/OR graphs, where AND nodes represent
  1196. configurations, and OR nodes represent version groups.
  1197. The model gives rise to a suit of selection rules for
  1198. composing configurations, almost all of which are implemented in RCS.
  1199. The revisions selected by RCS are passed to MAKE for configuration building.
  1200. Revision group management is modelled after SCCS.
  1201. RCS retains SCCS's best features,
  1202. but offers a significantly simpler user interface,
  1203. flexible selection rules, adequate integration with MAKE
  1204. and improved identification.
  1205. A detailed comparison of RCS and SCCS appears in Reference 4.
  1206. .PP
  1207. An important component of all revision control systems
  1208. is a program for computing deltas.
  1209. SCCS and RCS use the program \fIdiff\fR\u2\d,
  1210. which first computes the longest common substring of two
  1211. revisions, and then produces the delta from that substring.
  1212. The delta is simply an edit script consisting of deletion and
  1213. insertion commands that generate one revision from the other.
  1214. .PP
  1215. A delta based on a longest common substring is not necessarily minimal,
  1216. because it does not take advantage of crossing block moves.
  1217. Crossing block moves arise if two or more blocks of lines
  1218. (e.g., procedures)
  1219. appear in a different order in two revisions.
  1220. An edit script derived from a longest common substring
  1221. first deletes the shorter of the two blocks, and then reinserts it.
  1222. Heckel\u12\d
  1223. proposed an algorithm for detecting block moves, but
  1224. since the algorithm is based on heuristics,
  1225. there are conditions
  1226. under which the generated delta is far from minimal.
  1227. DSEE uses this algorithm combined with blank compression,
  1228. apparently with satisfactory overall results.
  1229. A new algorithm that is guaranteed to produce a minimal delta based on
  1230. block moves appears in Reference 13.
  1231. A future release of RCS will use this algorithm.
  1232. .PP
  1233. \fIAcknowledgements\fR:
  1234. Many people have helped make RCS a success by contributed criticisms, suggestions,
  1235. corrections, and even whole new commands (including manual pages).
  1236. The list of people is too long to be
  1237. reproduced here, but my sincere thanks for their help and
  1238. goodwill goes to all of them.
  1239. .sp
  1240. .nr VS 12p
  1241. .vs 12p
  1242. .SH
  1243. Appendix: Synopsis of RCS Operations
  1244. .LP
  1245. .IP "\fIci\fP \fB\- check in revisions\fP"
  1246. .sp 0
  1247. \fICi\fR stores the contents of a working file into the
  1248. corresponding RCS file as a new revision.
  1249. If the RCS file doesn't exist, \fIci\fR creates it.
  1250. \fICi\fR removes the working file, unless one of the options
  1251. \fI\-u\fR or \fI\-l\fR is present.
  1252. For each check-in, \fIci\fR asks for a commentary
  1253. describing the changes relative to the previous revision.
  1254. .sp 1
  1255. \fICi\fR assigns the revision number given by the \fI\-r\fR option;
  1256. if that option is missing, it derives the number from the
  1257. lock held by the user; if there is no lock and locking is not strict,
  1258. \fIci\fR increments the number of the latest revision on the trunk.
  1259. A side branch can only be started by explicitly specifying its
  1260. number with the \fI\-r\fR option during check-in.
  1261. .sp 1
  1262. \fICi\fR also determines
  1263. whether the revision to be checked in is different from the
  1264. previous one, and asks whether to proceed if not.
  1265. This facility simplifies check-in operations for large systems,
  1266. because one need not remember which files were changed.
  1267. .sp 1
  1268. The option \fI\-k\fR searches the checked in file for identification
  1269. markers containing
  1270. the attributes
  1271. revision number, check-in date, author and state, and assigns these
  1272. to the new revision rather than computing them.  This option is
  1273. useful for software distribution: Recipients of distributed software
  1274. using RCS should check in updates with the \fI\-k\fR option.
  1275. This convention guarantees that revision numbers, check-in dates,
  1276. etc., are the same at all sites.
  1277. .IP "\fIco\fP \fB\- check out revisions\fP"
  1278. .sp 0
  1279. \fICo\fR retrieves revisions according to revision number,
  1280. date, author and state attributes.  It either places the revision
  1281. into the working file, or prints it on the standard output.
  1282. \fICo\fR always expands the identification markers.
  1283. .IP "\fIident\fP \fB\- extract identification markers\fP"
  1284. .sp 0
  1285. \fIIdent\fR extracts the identification markers expanded by \fIco\fR
  1286. from any file and prints them.
  1287. .IP "\fIrcs\fP \fB\- change RCS file attributes\fP"
  1288. .sp 0
  1289. \fIRcs\fR is an administrative operation that changes access lists,
  1290. locks, unlocks, breaks locks, toggles the strict-locking feature,
  1291. sets state attributes and symbolic revision numbers, changes the
  1292. description, and deletes revisions.  A revision can
  1293. only be deleted if it is not the fork of a side branch.
  1294. .IP "\fIrcsclean\fP \fB\- clean working directory\fP"
  1295. .sp 0
  1296. .ne 10
  1297. \fIRcsclean\fR removes working files that were checked out but never changed.*
  1298. .FS *
  1299. The \fIrcsclean\fP and \fIrcsfreeze\fP commands
  1300. are optional and are not always installed.
  1301. .FE
  1302. .IP "\fIrcsdiff\fP \fB\- compare revisions\fP"
  1303. .sp 0
  1304. \fIRcsdiff\fR compares two revisions and prints their
  1305. difference, using the UNIX tool \fIdiff\fR.
  1306. One of the revisions compared may be checked out.
  1307. This command is useful for finding out about changes.
  1308. .IP "\fIrcsfreeze\fP \fB\- freeze a configuration\fP"
  1309. .sp 0
  1310. \fIRcsfreeze\fR assigns the same symbolic revision number
  1311. to a given revision in all RCS files.
  1312. This command is useful for accurately recording a configuration.*
  1313. .IP "\fIrcsmerge\fP \fB\- merge revisions\fP"
  1314. .sp 0
  1315. \fIRcsmerge\fR merges two revisions, \fIrev1\fR and \fIrev2\fR,
  1316. with respect to a common ancestor.
  1317. A 3-way file comparison determines the segments of lines that
  1318. are (a) the same in all three revisions, or (b) the same in 2 revisions,
  1319. or (c) different in all three.  For all segments of type (b) where
  1320. \fIrev1\fR is the differing revision,
  1321. the segment in \fIrev1\fR replaces the corresponding segment of \fIrev2\fR.
  1322. Type (c) indicates an overlapping change, is flagged as an error, and requires user
  1323. intervention to select the correct alternative.
  1324. .IP "\fIrlog\fP \fB\- read log messages\fP"
  1325. .sp 0
  1326. \fIRlog\fR prints the log messages and other information in an RCS file.
  1327. .bp
  1328. .LP
  1329. .nr VS 12p
  1330. .vs 12p
  1331. .]<
  1332. .ds [F 1
  1333. .]-
  1334. .ds [K FELD02
  1335. .ds [K MakeArticle
  1336. .ds [A Feldman, Stuart I.
  1337. .ds [D March 1979
  1338. .ds [T Make\*-A Program for Maintaining Computer Programs
  1339. .ds [J Software\*-Practice & Experience
  1340. .ds [V 9
  1341. .ds [N 3
  1342. .ds [P 255-265
  1343. .nr [P 1
  1344. .nr [T 0
  1345. .nr [A 1
  1346. .nr [O 0
  1347. .][ 1 journal-article
  1348. .ds [F 2
  1349. .]-
  1350. .ds [K HUNT01
  1351. .ds [T An Algorithm for Differential File Comparison
  1352. .ds [A Hunt, James W.
  1353. .as [A " and McIlroy, M. D.
  1354. .ds [I Computing Science Technical Report, Bell Laboratories
  1355. .ds [R 41
  1356. .ds [D June 1976
  1357. .nr [T 0
  1358. .nr [A 1
  1359. .nr [O 0
  1360. .][ 4 tech-report
  1361. .ds [F 3
  1362. .]-
  1363. .ds [K SCCS
  1364. .ds [A Rochkind, Marc J.
  1365. .ds [D Dec. 1975
  1366. .ds [T The Source Code Control System
  1367. .ds [J IEEE Transactions on Software Engineering
  1368. .ds [V SE-1
  1369. .ds [N 4
  1370. .ds [P 364-370
  1371. .nr [P 1
  1372. .nr [T 0
  1373. .nr [A 1
  1374. .nr [O 0
  1375. .][ 1 journal-article
  1376. .ds [F 4
  1377. .]-
  1378. .ds [K TICH08
  1379. .ds [T Design, Implementation, and Evaluation of a Revision Control System
  1380. .ds [A Tichy, Walter F.
  1381. .ds [B Proceedings of the 6th International Conference on Software Engineering
  1382. .ds [I ACM, IEEE, IPS, NBS
  1383. .ds [D September 1982
  1384. .ds [P 58-67
  1385. .nr [P 1
  1386. .nr [T 0
  1387. .nr [A 1
  1388. .nr [O 0
  1389. .][ 3 article-in-book
  1390. .ds [F 5
  1391. .]-
  1392. .ds [K LEBL01
  1393. .ds [A Leblang, David B.
  1394. .as [A " and Chase, Robert P.
  1395. .ds [T Computer-Aided Software Engineering in a Distributed Workstation Environment
  1396. .ds [O Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium
  1397. .as [O " on Practical Software Development Environments.
  1398. .ds [J SIGPLAN Notices
  1399. .ds [V 19
  1400. .ds [N 5
  1401. .ds [D May 1984
  1402. .ds [P 104-112
  1403. .nr [P 1
  1404. .nr [T 0
  1405. .nr [A 1
  1406. .nr [O 0
  1407. .][ 1 journal-article
  1408. .ds [F 1
  1409. .ds [F 3
  1410. .ds [F 6
  1411. .]-
  1412. .ds [K SCCSEval
  1413. .ds [A Glasser, Alan L.
  1414. .ds [D Nov. 1978
  1415. .ds [T The Evolution of a Source Code Control System
  1416. .ds [J Software Engineering Notes
  1417. .ds [V 3
  1418. .ds [N 5
  1419. .ds [P 122-125
  1420. .nr [P 1
  1421. .ds [O Proceedings of the Software Quality and Assurance Workshop.
  1422. .nr [T 0
  1423. .nr [A 1
  1424. .nr [O 1
  1425. .][ 1 journal-article
  1426. .ds [F 5
  1427. .ds [F 7
  1428. .]-
  1429. .ds [K IBMClearCaster
  1430. .ds [A Brown, H.B.
  1431. .ds [D 1970
  1432. .ds [T The Clear/Caster System
  1433. .ds [J Nato Conference on Software Engineering, Rome
  1434. .nr [T 0
  1435. .nr [A 1
  1436. .nr [O 0
  1437. .][ 1 journal-article
  1438. .ds [F 3
  1439. .ds [F 8
  1440. .]-
  1441. .ds [K HabermannSDC
  1442. .ds [A Habermann, A. Nico
  1443. .ds [D Jan. 1979
  1444. .ds [T A Software Development Control System
  1445. .ds [I Technical Report, Carnegie-Mellon University, Department of Computer Science
  1446. .nr [T 0
  1447. .nr [A 0
  1448. .nr [O 0
  1449. .][ 2 book
  1450. .ds [F 9
  1451. .]-
  1452. .ds [K CMS
  1453. .ds [A DEC
  1454. .ds [T Code Management System
  1455. .ds [I Digital Equipment Corporation
  1456. .ds [O Document No.\ EA-23134-82
  1457. .ds [D 1982
  1458. .nr [T 0
  1459. .nr [A 0
  1460. .nr [O 0
  1461. .][ 2 book
  1462. .ds [F 10
  1463. .]-
  1464. .ds [K LAMP01
  1465. .ds [A Lampson, Butler W.
  1466. .as [A " and Schmidt, Eric E.
  1467. .ds [T Practical Use of a Polymorphic Applicative Language
  1468. .ds [B Proceedings of the 10th Symposium on Principles of Programming Languages
  1469. .ds [I ACM
  1470. .ds [P 237-255
  1471. .nr [P 1
  1472. .ds [D January 1983
  1473. .nr [T 0
  1474. .nr [A 1
  1475. .nr [O 0
  1476. .][ 3 article-in-book
  1477. .ds [F 5
  1478. .ds [F 11
  1479. .]-
  1480. .ds [K TICH07
  1481. .ds [T A Data Model for Programming Support Environments and its Application
  1482. .ds [A Tichy, Walter F.
  1483. .ds [B Automated Tools for Information System Design and Development
  1484. .ds [E Hans-Jochen Schneider and Anthony I. Wasserman
  1485. .ds [C Amsterdam
  1486. .ds [I North-Holland Publishing Company
  1487. .ds [D 1982
  1488. .nr [T 0
  1489. .nr [A 1
  1490. .nr [O 0
  1491. .][ 3 article-in-book
  1492. .ds [F 4
  1493. .ds [F 2
  1494. .ds [F 12
  1495. .]-
  1496. .ds [K HECK01
  1497. .ds [T A Technique for Isolating Differences Between Files
  1498. .ds [A Heckel, Paul
  1499. .ds [J Communications of the ACM
  1500. .ds [D April 1978
  1501. .ds [V 21
  1502. .ds [N 4
  1503. .ds [P 264-268
  1504. .nr [P 1
  1505. .nr [T 0
  1506. .nr [A 0
  1507. .nr [O 0
  1508. .][ 1 journal-article
  1509. .ds [F 13
  1510. .]-
  1511. .ds [K TICH11
  1512. .ds [T The String-to-String Correction Problem with Block Moves
  1513. .ds [A Tichy, Walter F.
  1514. .ds [D Nov. 1984
  1515. .ds [J ACM Transactions on Computer Systems
  1516. .ds [V 2
  1517. .ds [N 4
  1518. .ds [P 309-321
  1519. .nr [P 1
  1520. .nr [T 0
  1521. .nr [A 1
  1522. .nr [O 0
  1523. .][ 1 journal-article
  1524. .]>
  1525.